<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: apps/include/pcl/apps/nn_classification.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('nn__classification_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">nn_classification.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Software License Agreement (BSD License)</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *  Point Cloud Library (PCL) - www.pointclouds.org</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *  Copyright (c) 2010-2012, Willow Garage, Inc.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *  All rights reserved.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *  Redistribution and use in source and binary forms, with or without</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *  modification, are permitted provided that the following conditions</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *  are met:</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *   * Redistributions of source code must retain the above copyright</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *     notice, this list of conditions and the following disclaimer.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *   * Redistributions in binary form must reproduce the above</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *     copyright notice, this list of conditions and the following</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> *     disclaimer in the documentation and/or other materials provided</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> *     with the distribution.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> *   * Neither the name of Willow Garage, Inc. nor the names of its</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> *     contributors may be used to endorse or promote products derived</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> *     from this software without specific prior written permission.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> *  &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment"> *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment"> *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment"> *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment"> *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment"> *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment"> *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment"> *  POSSIBILITY OF SUCH DAMAGE.</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment"> * $Id$</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#ifndef NNCLASSIFICATION_H_</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#define NNCLASSIFICATION_H_</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">#include &lt;cfloat&gt;</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">#include &lt;boost/foreach.hpp&gt;</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">#include &lt;boost/shared_ptr.hpp&gt;</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#include &lt;pcl/kdtree/kdtree_flann.h&gt;</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="keyword">namespace </span>pcl</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;{</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Po<span class="keywordtype">int</span>T&gt;</div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html">   59</a></span>&#160;  <span class="keyword">class </span><a class="code" href="classpcl_1_1_n_n_classification.html">NNClassification</a></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  {</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keyword">private</span>:</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;      <span class="keyword">typename</span> pcl::KdTree&lt;PointT&gt;::Ptr tree_;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">   66</a></span>&#160;      std::vector&lt;std::string&gt; <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">   68</a></span>&#160;      std::vector&lt;int&gt; <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160; </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="keyword">public</span>:</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html">NNClassification</a> () : tree_ (), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a> (), <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a> () {}</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a3ee26d1c66443ab14e484d591969b8a0">   75</a></span>&#160;      <span class="keyword">typedef</span> std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; <a class="code" href="classpcl_1_1_n_n_classification.html#a3ee26d1c66443ab14e484d591969b8a0">Result</a>;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;      <span class="keyword">typedef</span> boost::shared_ptr&lt;Result&gt; ResultPtr;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; </div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;      <span class="comment">// TODO setIndices method, distance metrics and reset tree</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;      <span class="keywordtype">void</span> </div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">   84</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">setTrainingFeatures</a> (<span class="keyword">const</span> <span class="keyword">typename</span> pcl::PointCloud&lt;PointT&gt;::ConstPtr &amp;features)</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;      {</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        <span class="comment">// Do not limit the number of dimensions used in the tree</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        <span class="keyword">typename</span> pcl::CustomPointRepresentation&lt;PointT&gt;::Ptr cpr (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_custom_point_representation.html">pcl::CustomPointRepresentation&lt;PointT&gt;</a> (INT_MAX, 0));</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        tree_.reset (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_kd_tree_f_l_a_n_n.html">pcl::KdTreeFLANN&lt;PointT&gt;</a>);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        tree_-&gt;<a class="code" href="classpcl_1_1_kd_tree.html#ab2c8cd07baaebb4e1504f223405419cc">setPointRepresentation</a> (cpr);</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        tree_-&gt;<a class="code" href="classpcl_1_1_kd_tree.html#ac105d90b2b10383adb58e62abe7b1161">setInputCloud</a> (features);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;      }</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;      <span class="keywordtype">void</span> </div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a7c06ebf50123854d0a4712654a944f23">   98</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a7c06ebf50123854d0a4712654a944f23">setTrainingLabelIndicesAndLUT</a> (<span class="keyword">const</span> std::vector&lt;std::string&gt; &amp;classes, <span class="keyword">const</span> std::vector&lt;int&gt; &amp;labels_idx)</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;      {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        <span class="comment">// TODO check if min/max index is inside classes?</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a> = classes;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a> = labels_idx;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;      }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;      <span class="keywordtype">void</span> </div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">  112</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">setTrainingLabels</a> (<span class="keyword">const</span> std::vector&lt;std::string&gt; &amp;labels)</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="comment">// Create a list of unique labels</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a> = labels;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        std::sort (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin(), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end());</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.erase (std::unique (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin(), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end()), <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end());</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        <span class="comment">// Save the mapping from labels to indices in the class list</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        std::map&lt;std::string, int&gt; label2idx;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;std::string&gt;::const_iterator it = <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin (); it != <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.end (); it++)</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;          label2idx[*it] = int (it - <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.begin ());</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        <span class="comment">// Create a list holding the class index of each label</span></div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.reserve (labels.size ());</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        BOOST_FOREACH (std::string s, labels)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;          <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.push_back (label2idx[s]);</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">//        for (std::vector&lt;std::string&gt;::const_iterator it = labels.begin (); it != labels.end (); it++)</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="comment">//          labels_idx_.push_back (label2idx[*it]);</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;      <span class="keywordtype">bool</span> </div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a39d8fcd0b119124f37578e58698780ea">  138</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a39d8fcd0b119124f37578e58698780ea">loadTrainingFeatures</a>(std::string file_name, std::string labels_file_name)</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;      {</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <span class="keyword">typename</span> pcl::PointCloud&lt;PointT&gt;::Ptr cloud (<span class="keyword">new</span> <a class="code" href="classpcl_1_1_point_cloud.html">pcl::PointCloud&lt;PointT&gt;</a>);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        <span class="keywordflow">if</span> (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0)</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        std::vector&lt;std::string&gt; labels;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        std::ifstream f (labels_file_name.c_str ());</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        std::string label;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <span class="keywordflow">while</span> (getline (f, label))</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;          <span class="keywordflow">if</span> (label.size () &gt; 0)</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            labels.push_back(label);</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        <span class="keywordflow">if</span> (labels.size () != cloud-&gt;<a class="code" href="classpcl_1_1_point_cloud.html#af16a62638198313b9c093127c492c884">points</a>.size ())</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">setTrainingFeatures</a> (cloud);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">setTrainingLabels</a> (labels);</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;        <span class="keywordflow">return</span> (<span class="keyword">true</span>);</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;      }</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;      <span class="keywordtype">bool</span> </div>
<div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a7c8be2d8883ec49769ac31e5756ef701">  162</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a7c8be2d8883ec49769ac31e5756ef701">saveTrainingFeatures</a> (std::string file_name, std::string labels_file_name)</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;      {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keyword">typename</span> pcl::PointCloud&lt;PointT&gt;::ConstPtr training_features = tree_-&gt;<a class="code" href="classpcl_1_1_kd_tree.html#a4839876a6d01bddc7984a3193e23d463">getInputCloud</a> ();</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>.size () == training_features-&gt;<a class="code" href="classpcl_1_1_point_cloud.html#af16a62638198313b9c093127c492c884">points</a>.size ())</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        {</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;          <span class="keywordflow">if</span> (pcl::io::savePCDFile (file_name.c_str (), *training_features) != 0)</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;          std::ofstream f (labels_file_name.c_str ());</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;          BOOST_FOREACH (<span class="keywordtype">int</span> i, <a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>)</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;            f &lt;&lt; <a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[i] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;          <span class="keywordflow">return</span> (<span class="keyword">true</span>);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        <span class="keywordflow">return</span> (<span class="keyword">false</span>);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;      }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;      ResultPtr </div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#ad0a5ee6bfd2250845459c03bd542fa74">  185</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#ad0a5ee6bfd2250845459c03bd542fa74">classify</a> (<span class="keyword">const</span> <a class="code" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, <span class="keywordtype">double</span> radius, <span class="keywordtype">float</span> gaussian_param, <span class="keywordtype">int</span> max_nn = INT_MAX)</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;      {</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;        std::vector&lt;int&gt; k_indices;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        std::vector&lt;float&gt; k_sqr_distances;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        <a class="code" href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">getSimilarExemplars</a> (p_q, radius, k_indices, k_sqr_distances, max_nn);</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;        <span class="keywordflow">return</span> (<a class="code" href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">getGaussianBestScores</a> (gaussian_param, k_indices, k_sqr_distances));</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;      }</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160; </div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;      <span class="keywordtype">int</span> </div>
<div class="line"><a name="l00202"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#ad65343adb76d5dada80d92daf31811ac">  202</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#ad65343adb76d5dada80d92daf31811ac">getKNearestExemplars</a> (<span class="keyword">const</span> <a class="code" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, <span class="keywordtype">int</span> k, std::vector&lt;int&gt; &amp;k_indices, std::vector&lt;float&gt; &amp;k_sqr_distances)</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;      {</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        k_indices.resize (k);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        k_sqr_distances.resize (k);</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        <span class="keywordflow">return</span> (tree_-&gt;<a class="code" href="classpcl_1_1_kd_tree.html#ac81c442ff9c9b1e03c10cb55128e726d">nearestKSearch</a> (p_q, k, k_indices, k_sqr_distances));</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;      }</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160; </div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;      <span class="keywordtype">int</span> </div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">  218</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">getSimilarExemplars</a> (<span class="keyword">const</span> <a class="code" href="structpcl_1_1_point_x_y_z_r_g_b_a.html">PointT</a> &amp;p_q, <span class="keywordtype">double</span> radius, std::vector&lt;int&gt; &amp;k_indices,</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;                           std::vector&lt;float&gt; &amp;k_sqr_distances, <span class="keywordtype">int</span> max_nn = INT_MAX)</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;      {</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        <span class="keywordflow">return</span> (tree_-&gt;<a class="code" href="classpcl_1_1_kd_tree.html#a662d9de50237121e142502a8737dfefa">radiusSearch</a> (p_q, radius, k_indices, k_sqr_distances, max_nn));</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;      }</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160; </div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;      boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; </div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">  230</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (std::vector&lt;int&gt; &amp;k_indices, std::vector&lt;float&gt; &amp;k_sqr_distances)</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;      {</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        <span class="comment">// Reserve space for distances</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances (<span class="keyword">new</span> std::vector&lt;float&gt; (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size (), FLT_MAX));</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160; </div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;        <span class="comment">// Select square distance to each class</span></div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;int&gt;::const_iterator i = k_indices.begin (); i != k_indices.end (); ++i)</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;          <span class="keywordflow">if</span> ((*sqr_distances)[<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>[*i]] &gt; k_sqr_distances[i - k_indices.begin ()])</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;            (*sqr_distances)[<a class="code" href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">labels_idx_</a>[*i]] = k_sqr_distances[i - k_indices.begin ()];</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <span class="keywordflow">return</span> (sqr_distances);</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;      }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;      ResultPtr </div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#add1e1efa2c94d209c7800694045001e9">  249</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#add1e1efa2c94d209c7800694045001e9">getLinearBestScores</a> (std::vector&lt;int&gt; &amp;k_indices, std::vector&lt;float&gt; &amp;k_sqr_distances)</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;      {</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        <span class="comment">// Get smallest squared distances and transform them to a score for each class</span></div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances = <a class="code" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (k_indices, k_sqr_distances);</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160; </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        <span class="comment">// Transform distances to scores</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;        <span class="keywordtype">double</span> sum_dist = 0;</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        boost::shared_ptr&lt;std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; &gt; result (<span class="keyword">new</span> std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; ());</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;        result-&gt;first.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        result-&gt;second.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::const_iterator it = sqr_distances-&gt;begin (); it != sqr_distances-&gt;end (); ++it)</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;          <span class="keywordflow">if</span> (*it != FLT_MAX)</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;          {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            result-&gt;first.push_back (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[it - sqr_distances-&gt;begin ()]);</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;            result-&gt;second.push_back (sqrt (*it));</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;            sum_dist += result-&gt;second.back ();</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;          }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::iterator it = result-&gt;second.begin (); it != result-&gt;second.end (); ++it)</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;          *it = 1 - *it/sum_dist;</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160; </div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;        <span class="comment">// Return label/score list pair</span></div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        <span class="keywordflow">return</span> (result);</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;      }</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160; </div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;      ResultPtr </div>
<div class="line"><a name="l00280"></a><span class="lineno"><a class="line" href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">  280</a></span>&#160;      <a class="code" href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">getGaussianBestScores</a> (<span class="keywordtype">float</span> gaussian_param, std::vector&lt;int&gt; &amp;k_indices, std::vector&lt;float&gt; &amp;k_sqr_distances)</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;      {</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        <span class="comment">// Get smallest squared distances and transform them to a score for each class</span></div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;        boost::shared_ptr&lt;std::vector&lt;float&gt; &gt; sqr_distances = <a class="code" href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">getSmallestSquaredDistances</a> (k_indices, k_sqr_distances);</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160; </div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;        <span class="comment">// Transform distances to scores</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;        boost::shared_ptr&lt;std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; &gt; result (<span class="keyword">new</span> std::pair&lt;std::vector&lt;std::string&gt;, std::vector&lt;float&gt; &gt; ());</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;        result-&gt;first.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        result-&gt;second.reserve (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>.size ());</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <span class="keywordflow">for</span> (std::vector&lt;float&gt;::const_iterator it = sqr_distances-&gt;begin (); it != sqr_distances-&gt;end (); ++it)</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;          <span class="keywordflow">if</span> (*it != FLT_MAX)</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;          {</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;            result-&gt;first.push_back (<a class="code" href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">classes_</a>[it - sqr_distances-&gt;begin ()]);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;            <span class="comment">// TODO leave it squared, and relate param to sigma...</span></div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;            result-&gt;second.push_back (expf (-std::sqrt (*it) / gaussian_param));</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;          }</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;        <span class="comment">// Return label/score list pair</span></div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;        <span class="keywordflow">return</span> (result);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;      }</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;  };</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;}</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160; </div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* NNCLASSIFICATION_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="aclasspcl_1_1_custom_point_representation_html"><div class="ttname"><a href="classpcl_1_1_custom_point_representation.html">pcl::CustomPointRepresentation</a></div><div class="ttdoc">CustomPointRepresentation extends PointRepresentation to allow for sub-part selection on the point.</div><div class="ttdef"><b>Definition:</b> point_representation.h:518</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_f_l_a_n_n_html"><div class="ttname"><a href="classpcl_1_1_kd_tree_f_l_a_n_n.html">pcl::KdTreeFLANN</a></div><div class="ttdoc">KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures. The class is making use...</div><div class="ttdef"><b>Definition:</b> kdtree_flann.h:70</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_html_a4839876a6d01bddc7984a3193e23d463"><div class="ttname"><a href="classpcl_1_1_kd_tree.html#a4839876a6d01bddc7984a3193e23d463">pcl::KdTree::getInputCloud</a></div><div class="ttdeci">PointCloudConstPtr getInputCloud() const</div><div class="ttdoc">Get a pointer to the input point cloud dataset.</div><div class="ttdef"><b>Definition:</b> kdtree.h:103</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_html_a662d9de50237121e142502a8737dfefa"><div class="ttname"><a href="classpcl_1_1_kd_tree.html#a662d9de50237121e142502a8737dfefa">pcl::KdTree::radiusSearch</a></div><div class="ttdeci">virtual int radiusSearch(const PointT &amp;p_q, double radius, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances, unsigned int max_nn=0) const =0</div><div class="ttdoc">Search for all the nearest neighbors of the query point in a given radius.</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_html_ab2c8cd07baaebb4e1504f223405419cc"><div class="ttname"><a href="classpcl_1_1_kd_tree.html#ab2c8cd07baaebb4e1504f223405419cc">pcl::KdTree::setPointRepresentation</a></div><div class="ttdeci">void setPointRepresentation(const PointRepresentationConstPtr &amp;point_representation)</div><div class="ttdoc">Provide a pointer to the point representation to use to convert points into k-D vectors.</div><div class="ttdef"><b>Definition:</b> kdtree.h:112</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_html_ac105d90b2b10383adb58e62abe7b1161"><div class="ttname"><a href="classpcl_1_1_kd_tree.html#ac105d90b2b10383adb58e62abe7b1161">pcl::KdTree::setInputCloud</a></div><div class="ttdeci">virtual void setInputCloud(const PointCloudConstPtr &amp;cloud, const IndicesConstPtr &amp;indices=IndicesConstPtr())</div><div class="ttdoc">Provide a pointer to the input dataset.</div><div class="ttdef"><b>Definition:</b> kdtree.h:88</div></div>
<div class="ttc" id="aclasspcl_1_1_kd_tree_html_ac81c442ff9c9b1e03c10cb55128e726d"><div class="ttname"><a href="classpcl_1_1_kd_tree.html#ac81c442ff9c9b1e03c10cb55128e726d">pcl::KdTree::nearestKSearch</a></div><div class="ttdeci">virtual int nearestKSearch(const PointT &amp;p_q, int k, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances) const =0</div><div class="ttdoc">Search for k-nearest neighbors for the given query point.</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html">pcl::NNClassification</a></div><div class="ttdoc">Nearest neighbor search based classification of PCL point type features. FLANN is used to identify a ...</div><div class="ttdef"><b>Definition:</b> nn_classification.h:60</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a240a675d7ba75bbc77482ed7accc7ce0"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a240a675d7ba75bbc77482ed7accc7ce0">pcl::NNClassification::setTrainingLabels</a></div><div class="ttdeci">void setTrainingLabels(const std::vector&lt; std::string &gt; &amp;labels)</div><div class="ttdoc">Setting the labels for each training example. The unique labels from the list are stored as the class...</div><div class="ttdef"><b>Definition:</b> nn_classification.h:112</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a39d8fcd0b119124f37578e58698780ea"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a39d8fcd0b119124f37578e58698780ea">pcl::NNClassification::loadTrainingFeatures</a></div><div class="ttdeci">bool loadTrainingFeatures(std::string file_name, std::string labels_file_name)</div><div class="ttdoc">Load the list of training examples and corresponding labels.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:138</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a3e791bb176825ee2a2e2890efca4505b"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a3e791bb176825ee2a2e2890efca4505b">pcl::NNClassification::getSimilarExemplars</a></div><div class="ttdeci">int getSimilarExemplars(const PointT &amp;p_q, double radius, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances, int max_nn=INT_MAX)</div><div class="ttdoc">Search for all the nearest neighbors of the query point in a given radius.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:218</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a3ee26d1c66443ab14e484d591969b8a0"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a3ee26d1c66443ab14e484d591969b8a0">pcl::NNClassification::Result</a></div><div class="ttdeci">std::pair&lt; std::vector&lt; std::string &gt;, std::vector&lt; float &gt; &gt; Result</div><div class="ttdoc">Result is a list of class labels and scores</div><div class="ttdef"><b>Definition:</b> nn_classification.h:75</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a52bec8579465e01bf4ed1ed9667c69bb"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a52bec8579465e01bf4ed1ed9667c69bb">pcl::NNClassification::setTrainingFeatures</a></div><div class="ttdeci">void setTrainingFeatures(const typename pcl::PointCloud&lt; PointT &gt;::ConstPtr &amp;features)</div><div class="ttdoc">Setting the training features.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:84</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a703c1ed4ec46fc697ec076d78a15d2aa"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a703c1ed4ec46fc697ec076d78a15d2aa">pcl::NNClassification::getGaussianBestScores</a></div><div class="ttdeci">ResultPtr getGaussianBestScores(float gaussian_param, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Computes a score exponentially decreasing with the distance for each class given a neighborhood.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:280</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a7c06ebf50123854d0a4712654a944f23"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a7c06ebf50123854d0a4712654a944f23">pcl::NNClassification::setTrainingLabelIndicesAndLUT</a></div><div class="ttdeci">void setTrainingLabelIndicesAndLUT(const std::vector&lt; std::string &gt; &amp;classes, const std::vector&lt; int &gt; &amp;labels_idx)</div><div class="ttdoc">Updating the labels for each training example.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:98</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_a7c8be2d8883ec49769ac31e5756ef701"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#a7c8be2d8883ec49769ac31e5756ef701">pcl::NNClassification::saveTrainingFeatures</a></div><div class="ttdeci">bool saveTrainingFeatures(std::string file_name, std::string labels_file_name)</div><div class="ttdoc">Save the list of training examples and corresponding labels.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:162</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aa89d07e6c77bfc5667fadcac1c6a68b8"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aa89d07e6c77bfc5667fadcac1c6a68b8">pcl::NNClassification::getSmallestSquaredDistances</a></div><div class="ttdeci">boost::shared_ptr&lt; std::vector&lt; float &gt; &gt; getSmallestSquaredDistances(std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Gets the smallest square distance to each class given a neighborhood.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:230</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aac238edad83e267297c2281dbad39d3a"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aac238edad83e267297c2281dbad39d3a">pcl::NNClassification::labels_idx_</a></div><div class="ttdeci">std::vector&lt; int &gt; labels_idx_</div><div class="ttdoc">The index in the class labels list for all the training examples</div><div class="ttdef"><b>Definition:</b> nn_classification.h:68</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_ad0a5ee6bfd2250845459c03bd542fa74"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#ad0a5ee6bfd2250845459c03bd542fa74">pcl::NNClassification::classify</a></div><div class="ttdeci">ResultPtr classify(const PointT &amp;p_q, double radius, float gaussian_param, int max_nn=INT_MAX)</div><div class="ttdoc">Utility function for the default classification process.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:185</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_ad65343adb76d5dada80d92daf31811ac"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#ad65343adb76d5dada80d92daf31811ac">pcl::NNClassification::getKNearestExemplars</a></div><div class="ttdeci">int getKNearestExemplars(const PointT &amp;p_q, int k, std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Search for k-nearest neighbors for the given query point.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:202</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_add1e1efa2c94d209c7800694045001e9"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#add1e1efa2c94d209c7800694045001e9">pcl::NNClassification::getLinearBestScores</a></div><div class="ttdeci">ResultPtr getLinearBestScores(std::vector&lt; int &gt; &amp;k_indices, std::vector&lt; float &gt; &amp;k_sqr_distances)</div><div class="ttdoc">Computes a score that is inversely proportional to the distance to each class given a neighborhood.</div><div class="ttdef"><b>Definition:</b> nn_classification.h:249</div></div>
<div class="ttc" id="aclasspcl_1_1_n_n_classification_html_aedeacc2a645a022a4306395a10c1cbfa"><div class="ttname"><a href="classpcl_1_1_n_n_classification.html#aedeacc2a645a022a4306395a10c1cbfa">pcl::NNClassification::classes_</a></div><div class="ttdeci">std::vector&lt; std::string &gt; classes_</div><div class="ttdoc">List of class labels</div><div class="ttdef"><b>Definition:</b> nn_classification.h:66</div></div>
<div class="ttc" id="aclasspcl_1_1_point_cloud_html"><div class="ttname"><a href="classpcl_1_1_point_cloud.html">pcl::PointCloud</a></div><div class="ttdoc">PointCloud represents the base class in PCL for storing collections of 3D points.</div><div class="ttdef"><b>Definition:</b> point_cloud.h:173</div></div>
<div class="ttc" id="aclasspcl_1_1_point_cloud_html_af16a62638198313b9c093127c492c884"><div class="ttname"><a href="classpcl_1_1_point_cloud.html#af16a62638198313b9c093127c492c884">pcl::PointCloud::points</a></div><div class="ttdeci">std::vector&lt; PointT, Eigen::aligned_allocator&lt; PointT &gt; &gt; points</div><div class="ttdoc">The point data.</div><div class="ttdef"><b>Definition:</b> point_cloud.h:410</div></div>
<div class="ttc" id="astructpcl_1_1_point_x_y_z_r_g_b_a_html"><div class="ttname"><a href="structpcl_1_1_point_x_y_z_r_g_b_a.html">pcl::PointXYZRGBA</a></div><div class="ttdoc">A point structure representing Euclidean xyz coordinates, and the RGBA color.</div><div class="ttdef"><b>Definition:</b> point_types.hpp:540</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_9654b8d08f4bba4e84b362c5fd320bee.html">apps</a></li><li class="navelem"><a class="el" href="dir_0a0d5da700a5a4a1bb9e31860c7b5987.html">include</a></li><li class="navelem"><a class="el" href="dir_d03b3f6ff3405343f7cd5c7bdc4c3753.html">pcl</a></li><li class="navelem"><a class="el" href="dir_86ba21351ee8ee2fe236c78d4d24cba9.html">apps</a></li><li class="navelem"><b>nn_classification.h</b></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
